// pages/list/list.js
const app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    imgurl:app.imgurl,
    rankingnav: [
      { txt: '个人票数排名' },
      { txt: '待助推节目排行' },
    ],
    ranking: [
      // { name: '张丹丹', icon_num: '4', pic: 'icon_01.png', ads: '总部(碑林)校区', num: '25' },
      // { name: '张丹丹', icon_num: '5', pic: 'icon_01.png', ads: '总部(碑林)校区', num: '5000' },
      // { name: '张丹丹', icon_num: '6', pic: 'icon_01.png', ads: '总部(碑林)校区', num: '12' },
    ],
    rankingt: [
      // { name: '张丹丹', icon_num: '4', pic: 'icon_01.png', ads: '总部(碑林)校区', num: '1525' },
      // { name: '张丹丹', icon_num: '5', pic: 'icon_01.png', ads: '总部(碑林)校区', num: '1525' },
      // { name: '张丹丹', icon_num: '16', pic: 'icon_01.png', ads: '总部(碑林)校区', num: '1525' },
    ],
    navindex: 0,
  },
  rankingClick: function (e) {
    var id = e.currentTarget.dataset.id;
    console.log(id)
    this.setData({
      navindex: id
    })
  },
  navTo: function (e) {
    app.navTo(e.currentTarget.dataset.url)
  },
  //个人票数排名
  getpersonal(){
    let that = this;
    app.request({
      url: 'index/user_vote_api/PersonalRanking',
      method: 'post',
      type: 0,
      data: {
 
      },
      success: function (res) {      
        console.log(res)
        that.setData({
          ranking: res.data
        }) 
      }
    })
  },
  //特助推节目
  getbooster() {
    let that = this;
    app.request({
      url: 'index/user_vote_api/BoostRankingList',
      method: 'post',
      type: 0,
      data: {

      },
      success: function (res) {
        console.log(res)
        that.setData({
          rankingt: res.data
        })
      }
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {    
    let that = this;
    that.setData({
      navindex: options.type ? options.type: 0
    })
    that.getpersonal()
    that.getbooster()
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})